package com.gaofeng.customviewdemo

import android.os.Bundle
import android.view.View
import android.view.animation.Animation
import android.view.animation.LinearInterpolator
import android.view.animation.RotateAnimation
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity
import com.roger.catloadinglibrary.CatLoadingView

class CatLoadingActivity : AppCompatActivity() {

    private var dialogFragment: CatLoadingView? = null
//    private lateinit var ivMouse: ImageView
//    private lateinit var graduallyTextView: GraduallyTextView2
//    private lateinit var rotateAnimation: RotateAnimation
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_cat_loading)
//        findViewById<View>(R.id.button).setOnClickListener {
//            CatLoadingView().show(
//                supportFragmentManager,
//                ""
//            )
//        }
        dialogFragment = CatLoadingView()
//        ivMouse = findViewById(R.id.iv_mouse)
//        graduallyTextView = findViewById(R.id.graduallyTextView2)
//        rotateAnimation = RotateAnimation(
//            360f, 0f, Animation.RELATIVE_TO_SELF, 0.5f,
//            Animation.RELATIVE_TO_SELF, 0.5f
//        )
//        rotateAnimation.interpolator = LinearInterpolator()
//        rotateAnimation.duration = 2000
//        rotateAnimation.repeatCount = Animation.INFINITE

    }

    override fun onResume() {
        super.onResume()
        dialogFragment?.show(supportFragmentManager, "")
//        ivMouse.animation = rotateAnimation
//        graduallyTextView.startLoading()
    }

    override fun onPause() {
        super.onPause()
        dialogFragment?.dismiss()
//        graduallyTextView.stopLoading()
    }

    override fun onDestroy() {
        super.onDestroy()
        dialogFragment?.dismiss()
        dialogFragment = null
    }
}